package com.jia.leetCode;

import java.util.ArrayList;
import java.util.List;

/**
 * 1408. 数组中的字符串匹配
 */
public class Pro1408 {
    //暴力
    public List<String> stringMatching(String[] words) {
        List<String> ans = new ArrayList<>();
        for(String word : words) {
            for(int i = 0; i < words.length; i++) {
                if(word.length() >= words[i].length()) continue;
                if(words[i].contains(word)) {
                    ans.add(word);
                    break;
                }
            }
        }
        return ans;
    }
}
